﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="_4T.Login" %>

<!doctype html>
<!--[if lt IE 8 ]><html lang="en" class="no-js ie ie7"><![endif]-->
<!--[if IE 8 ]><html lang="en" class="no-js ie"><![endif]-->
<!--[if (gt IE 8)|!(IE)]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>Hệ thống trợ giúp y tế</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Global stylesheets -->
    <link href="css/reset.css" rel="stylesheet" type="text/css">
    <link href="css/common.css" rel="stylesheet" type="text/css">
    <link href="css/form.css" rel="stylesheet" type="text/css">
    <link href="css/standard.css" rel="stylesheet" type="text/css">
    <link href="css/special-pages.css" rel="stylesheet" type="text/css">
    <link href="css/custom.css" rel="stylesheet" type="text/css">

    <!-- Favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
    <link rel="icon" type="image/png" href="favicon-large.png">

    <!-- Modernizr for support detection, all javascript libs are moved right above </body> for better performance -->
    <script src="js/libs/modernizr.custom.min.js"></script>

</head>

<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page login-bg dark">

    <%--<section id="message">
		<div class="block-border"><div class="block-content no-title dark-bg">
			<p class="mini-infos">For demo website, use <b>admin</b> / <b>admin</b></p>
		</div></div>
	</section>--%>

    <section id="login-block">
        <div class="block-border">
            <div class="block-content" style="padding: 1.667em; padding-top: 2.833em;">

                <!--
			IE7 compatibility: if you want to remove the <h1>, 
			add style="zoom:1" to the above .block-content div
			-->
                <%--<h1>Admin</h1>--%>
                <div class="block-header" style="background: #03406A; color: #FFF;">Đăng nhập</div>

                <p id="pErrorMsg" class="message error no-margin" runat="server" style="display: none;">
                    <asp:Literal runat="server" ID="ltrErrorMsg"></asp:Literal>
                </p>

                <form class="form with-margin" name="loginForm" id="loginForm" method="post" action="" runat="server">
                    <input type="hidden" name="a" id="a" value="send">
                    <p class="inline-small-label">
                        <label for="login"><span class="medium">Tên đăng nhập</span></label>
                        <asp:TextBox ID="txtUsername" runat="server" CssClass="full-width"></asp:TextBox>
                        <%--<input type="text" name="login" id="login" class="full-width" value="">--%>
                    </p>
                    <p class="inline-small-label">
                        <label for="pass"><span class="medium">Mật khẩu</span></label>
                        <asp:TextBox ID="txtPassword" runat="server" CssClass="full-width" TextMode="Password"></asp:TextBox>
                        <%--<input type="password" name="pass" id="pass" class="full-width" value="">--%>
                    </p>
                    <asp:Button ID="btnLogin" runat="server" CssClass="big-button float-right login_button"
                        Text="Đăng nhập" OnClick="btnLogin_Click" />
                    <%--<button type="submit" class="float-right">Login</button>--%>
                    <p class="input-height">
                        <%--<input type="checkbox" name="keep-logged" id="keep-logged" value="1" class="mini-switch" checked="checked">
					<label for="keep-logged" class="inline">Keep me logged in</label>--%>
                    </p>
                </form>
                <%--<a href="Register.aspx">Đăng ký tài khoản</a>--%>
                <%--<form class="form" id="" method="post" action="">
				<fieldset class="grey-bg no-margin collapse">
					<legend><a href="Register.aspx">Đăng ký tài khoản</a></legend>					
				</fieldset>
			</form>--%>
            </div>
        </div>
    </section>

    <!--
	
	Updated as v1.5:
	Libs are moved here to improve performance
	
	-->

    <!-- Generic libs -->
    <script src="js/libs/jquery-1.6.3.min.js"></script>
    <script src="js/old-browsers.js"></script>
    <!-- remove if you do not need older browsers detection -->

    <!-- Template libs -->
    <script src="js/common.js"></script>
    <script src="js/standard.js"></script>
    <!--[if lte IE 8]><script src="js/standard.ie.js"></script><![endif]-->
    <script src="js/jquery.tip.js"></script>

    <!-- example login script -->
    <script>

        $(document).ready(function () {
            // We'll catch form submission to do it in AJAX, but this works also with JS disabled
            $('#loginForm').submit(function (event) {
                // Stop full page load
                //event.preventDefault();

                // Check fields
                var login = document.getElementById("<%=txtUsername.ClientID %>").value;// $('#login').val();
                var pass = document.getElementById("<%=txtPassword.ClientID %>").value; //$('#pass').val();

                if (!login || login.length == 0) {
                    $('#login-block').removeBlockMessages().blockMessage('Vui lòng nhập tên đăng nhập', { type: 'warning' });
                    event.preventDefault();
                }
                else if (!pass || pass.length == 0) {
                    $('#login-block').removeBlockMessages().blockMessage('Vui lòng nhập mật khẩu', { type: 'warning' });
                    event.preventDefault();
                }
                //	            else {
                //	                var submitBt = $(this).find('button[type=submit]');
                //	                submitBt.disableBt();

                //	                // Target url
                //	                var target = $(this).attr('action');
                //	                if (!target || target == '') {
                //	                    // Page url without hash
                //	                    target = document.location.href.match(/^([^#]+)/)[1];
                //	                }

                //	                // Request
                //	                var data = {
                //	                    a: $('#a').val(),
                //	                    login: login,
                //	                    pass: pass,
                //	                    'keep-logged': $('#keep-logged').attr('checked') ? 1 : 0
                //	                },
                //						redirect = $('#redirect'),
                //						sendTimer = new Date().getTime();

                //	                if (redirect.length > 0) {
                //	                    data.redirect = redirect.val();
                //	                }

                //	                // Send
                //	                $.ajax({
                //	                    url: target,
                //	                    dataType: 'json',
                //	                    type: 'POST',
                //	                    data: data,
                //	                    success: function (data, textStatus, XMLHttpRequest) {
                //	                        if (data.valid) {
                //	                            // Small timer to allow the 'cheking login' message to show when server is too fast
                //	                            var receiveTimer = new Date().getTime();
                //	                            if (receiveTimer - sendTimer < 500) {
                //	                                setTimeout(function () {
                //	                                    document.location.href = data.redirect;

                //	                                }, 500 - (receiveTimer - sendTimer));
                //	                            }
                //	                            else {
                //	                                document.location.href = data.redirect;
                //	                            }
                //	                        }
                //	                        else {
                //	                            // Message
                //	                            $('#login-block').removeBlockMessages().blockMessage(data.error || 'An unexpected error occured, please try again', { type: 'error' });

                //	                            submitBt.enableBt();
                //	                        }
                //	                    },
                //	                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                //	                        // Message
                //	                        $('#login-block').removeBlockMessages().blockMessage('Error while contacting server, please try again', { type: 'error' });

                //	                        submitBt.enableBt();
                //	                    }
                //	                });

                // Message
                //	                $('#login-block').removeBlockMessages().blockMessage('Please wait, cheking login...', { type: 'loading' });
                //	            }
            });
        });

    </script>

</body>
</html>

